package com.donghua.exception;

import com.donghua.enums.StatusCodeEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;


import static com.donghua.enums.StatusCodeEnum.FAIL;

/**
 * @author Cai Lideng
 * @date 2022年04月19日 下午12:25
 * @description TODO
 */
@Getter
public class BizException extends RuntimeException{

    private Integer code = FAIL.getCode();

    private final String message;

    public BizException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public BizException(StatusCodeEnum statusCodeEnum) {
        this.code = statusCodeEnum.getCode();
        this.message = statusCodeEnum.getMsg();
    }
}
